# chrome.exe --remote-debugging-port=9222 --user-data-dir="D:\selenium_ui_auto\chrome_temp"
from selenium import webdriver
import time
from selenium.webdriver.chrome.options import Options

# 声明浏览器，打开远程调试
Chrome_options = Options()
Chrome_options.add_experimental_option('debuggerAddress', "127.0.0.1:9222")
browser = webdriver.Chrome(options=Chrome_options)

# 找到html文件并打开
Path_name = 'D:/PythonWorkspace/python100/Day54/selenium.html'
browser.get(Path_name)

# 查找元素并操作
Submit_button = browser.find_element_by_css_selector('div#signup form').submit()
time.sleep(2)
dig_alert = browser.switch_to.alert
time.sleep(1)
dig_alert.accept()
time.sleep(1)

# 关闭浏览器
browser.quit()